home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / slzwx.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  3.0 KB  |  80 lines

  1. /* Copyright (C) 1993, 1995, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: slzwx.h,v 1.2 2000/09/19 19:00:50 lpd Exp $ */
  20. /* Definitions for LZW filters */
  21. /* Requires strimpl.h */
  22.  
  23. #ifndef slzwx_INCLUDED
  24. #  define slzwx_INCLUDED
  25.  
  26. typedef struct lzw_decode_s lzw_decode;
  27. typedef struct lzw_encode_table_s lzw_encode_table;
  28. typedef struct stream_LZW_state_s {
  29.     stream_state_common;
  30.     /* The following are set before initialization. */
  31.     int InitialCodeLength;    /* decoding only */
  32.     /*
  33.      * Adobe calls FirstBitLowOrder LowBitFirst.  Either one will work
  34.      * in PostScript code.
  35.      */
  36.     bool FirstBitLowOrder;    /* decoding only */
  37.     bool BlockData;        /* decoding only */
  38.     int EarlyChange;        /* decoding only */
  39.     /* The following are updated dynamically. */
  40.     uint bits;            /* buffer for input bits */
  41.     int bits_left;        /* Decode: # of valid bits left, [0..7] */
  42.                 /* (low-order bits if !FirstBitLowOrder, */
  43.                 /* high-order bits if FirstBitLowOrder) */
  44.     int bytes_left;        /* # of bytes left in current block */
  45.                 /* (arbitrary large # if not GIF) */
  46.     union _lzt {
  47.     lzw_decode *decode;
  48.     lzw_encode_table *encode;
  49.     } table;
  50.     uint next_code;        /* next code to be assigned */
  51.     int code_size;        /* current # of bits per code */
  52.     int prev_code;        /* previous code recognized or assigned */
  53.     uint prev_len;        /* length of prev_code */
  54.     int copy_code;        /* code whose string is being */
  55.                 /* copied, -1 if none */
  56.     uint copy_len;        /* length of copy_code */
  57.     int copy_left;        /* amount of string left to copy */
  58.     bool first;            /* true if no output yet */
  59. } stream_LZW_state;
  60.  
  61. extern_st(st_LZW_state);
  62. #define public_st_LZW_state()    /* in slzwc.c */\
  63.   gs_public_st_ptrs1(st_LZW_state, stream_LZW_state,\
  64.     "LZWDecode state", lzwd_enum_ptrs, lzwd_reloc_ptrs, table.decode)
  65. #define s_LZW_set_defaults_inline(ss)\
  66.   ((ss)->InitialCodeLength = 8,\
  67.    (ss)->FirstBitLowOrder = false,\
  68.    (ss)->BlockData = false,\
  69.    (ss)->EarlyChange = 1,\
  70.    /* Clear pointers */\
  71.    (ss)->table.decode /*=encode*/ = 0)
  72. extern const stream_template s_LZWD_template;
  73. extern const stream_template s_LZWE_template;
  74.  
  75. /* Shared procedures */
  76. void s_LZW_set_defaults(P1(stream_state *));
  77. void s_LZW_release(P1(stream_state *));
  78.  
  79. #endif /* slzwx_INCLUDED */
  80.